<html>
<head><meta charset="utf-8"><title>Do the const SIMD-shuffle? · t-compiler/const-eval · Zulip Chat Archive</title></head>
<h2>Stream: <a href="https://rust-lang.github.io/zulip_archive/stream/146212-t-compiler/const-eval/index.html">t-compiler/const-eval</a></h2>
<h3>Topic: <a href="https://rust-lang.github.io/zulip_archive/stream/146212-t-compiler/const-eval/topic/Do.20the.20const.20SIMD-shuffle.3F.html">Do the const SIMD-shuffle?</a></h3>

<hr>

<base href="https://rust-lang.zulipchat.com">

<head><link href="https://rust-lang.github.io/zulip_archive/style.css" rel="stylesheet"></head>

<a name="207918829"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/146212-t-compiler/const-eval/topic/Do%20the%20const%20SIMD-shuffle%3F/near/207918829" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jubilee <a href="https://rust-lang.github.io/zulip_archive/stream/146212-t-compiler/const-eval/topic/Do.20the.20const.20SIMD-shuffle.3F.html#207918829">(Aug 25 2020 at 02:13)</a>:</h4>
<p>Hello! There is a <a href="https://github.com/rust-lang/rfcs/pull/2948">"so, SIMD in core?" proposal</a> that has bumped up against "so, we using const generics for this?" for some particular functions, namely to represent SIMD shuffles. There are macro-based SIMD shuffles that are functional but a hoped-for const generic form is considered more elegant and would probably err properly at compile-time. That started <a href="#narrow/stream/219381-t-libs/topic/.60packed_simd.60.20crate.20status.2Fmaintenance.3F/near/207815297">here in t-libs</a> and has <a href="#narrow/stream/219381-t-libs/topic/.60packed_simd.60.20crate.20status.2Fmaintenance.3F/near/207874587">reached a question as to what is const-evaluable within <code>min_const_generics</code> and <code>const fn</code></a>. It would be lovely if const-eval could weigh in!</p>



<a name="207927873"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/146212-t-compiler/const-eval/topic/Do%20the%20const%20SIMD-shuffle%3F/near/207927873" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/146212-t-compiler/const-eval/topic/Do.20the.20const.20SIMD-shuffle.3F.html#207927873">(Aug 25 2020 at 06:13)</a>:</h4>
<p>It looks to me like this needs <a href="https://github.com/rust-lang/compiler-team/issues/340">https://github.com/rust-lang/compiler-team/issues/340</a>, which I will hopefully implement in the next month(s).</p>



<a name="207927943"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/146212-t-compiler/const-eval/topic/Do%20the%20const%20SIMD-shuffle%3F/near/207927943" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/146212-t-compiler/const-eval/topic/Do.20the.20const.20SIMD-shuffle.3F.html#207927943">(Aug 25 2020 at 06:14)</a>:</h4>
<p>you can then write <code>fn simd_stuff&lt;const N: usize&gt;() where [u8;  BOUND - N]</code> which fails to compile if <code>N</code> is greater than <code>BOUND</code></p>



<a name="207937646"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/146212-t-compiler/const-eval/topic/Do%20the%20const%20SIMD-shuffle%3F/near/207937646" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jubilee <a href="https://rust-lang.github.io/zulip_archive/stream/146212-t-compiler/const-eval/topic/Do.20the.20const.20SIMD-shuffle.3F.html#207937646">(Aug 25 2020 at 08:46)</a>:</h4>
<p>oh nice! That would be _lovely_ to see, yes!</p>



<a name="207939015"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/146212-t-compiler/const-eval/topic/Do%20the%20const%20SIMD-shuffle%3F/near/207939015" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/146212-t-compiler/const-eval/topic/Do.20the.20const.20SIMD-shuffle.3F.html#207939015">(Aug 25 2020 at 09:04)</a>:</h4>
<p>one note is that while these bounds will most probably be implemented before <code>min_const_generics</code> is stable, they will not be stabilized with <code>min_const_generics</code>.</p>



<a name="207939173"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/146212-t-compiler/const-eval/topic/Do%20the%20const%20SIMD-shuffle%3F/near/207939173" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/146212-t-compiler/const-eval/topic/Do.20the.20const.20SIMD-shuffle.3F.html#207939173">(Aug 25 2020 at 09:07)</a>:</h4>
<p>I personally expect us to still be able to add these bounds to methods we want to stabilize even if they can only be satisfied by using concrete values. That would forbid users on stable from writing <code>simd_stuff::&lt;CONST_PARAM&gt;</code> at the start</p>



<a name="207939292"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/146212-t-compiler/const-eval/topic/Do%20the%20const%20SIMD-shuffle%3F/near/207939292" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jubilee <a href="https://rust-lang.github.io/zulip_archive/stream/146212-t-compiler/const-eval/topic/Do.20the.20const.20SIMD-shuffle.3F.html#207939292">(Aug 25 2020 at 09:08)</a>:</h4>
<p>I mean, the entire thing (core::simd) would go in as unstable in the first place anyways, right?</p>



<a name="207939329"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/146212-t-compiler/const-eval/topic/Do%20the%20const%20SIMD-shuffle%3F/near/207939329" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/146212-t-compiler/const-eval/topic/Do.20the.20const.20SIMD-shuffle.3F.html#207939329">(Aug 25 2020 at 09:08)</a>:</h4>
<p>I would expect this to be the case</p>



<a name="207939350"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/146212-t-compiler/const-eval/topic/Do%20the%20const%20SIMD-shuffle%3F/near/207939350" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/146212-t-compiler/const-eval/topic/Do.20the.20const.20SIMD-shuffle.3F.html#207939350">(Aug 25 2020 at 09:09)</a>:</h4>
<p>so this would only be relevant if you want to stabilize <code>core::simd</code> before we stabilize const wf bounds</p>



<a name="207939456"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/146212-t-compiler/const-eval/topic/Do%20the%20const%20SIMD-shuffle%3F/near/207939456" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/146212-t-compiler/const-eval/topic/Do.20the.20const.20SIMD-shuffle.3F.html#207939456">(Aug 25 2020 at 09:10)</a>:</h4>
<p>can't really say how much longer it will take to go from <code>min_const_generics</code> to full <code>const_generics</code> stabilization</p>



<a name="207939495"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/146212-t-compiler/const-eval/topic/Do%20the%20const%20SIMD-shuffle%3F/near/207939495" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jubilee <a href="https://rust-lang.github.io/zulip_archive/stream/146212-t-compiler/const-eval/topic/Do.20the.20const.20SIMD-shuffle.3F.html#207939495">(Aug 25 2020 at 09:11)</a>:</h4>
<p>There would be several SIMD-related functions and types that could be stabilized first without requiring shuffles except on nightly, so this would be a good move forward, and it would invite a lot of testing of const generics anyways.</p>



<a name="207939530"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/146212-t-compiler/const-eval/topic/Do%20the%20const%20SIMD-shuffle%3F/near/207939530" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/146212-t-compiler/const-eval/topic/Do.20the.20const.20SIMD-shuffle.3F.html#207939530">(Aug 25 2020 at 09:11)</a>:</h4>
<p>yeah, what I wanted to say is that I expect it to be fine to even stabilize shuffles, even if they use const wf bounds</p>



<a name="207939630"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/146212-t-compiler/const-eval/topic/Do%20the%20const%20SIMD-shuffle%3F/near/207939630" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jubilee <a href="https://rust-lang.github.io/zulip_archive/stream/146212-t-compiler/const-eval/topic/Do.20the.20const.20SIMD-shuffle.3F.html#207939630">(Aug 25 2020 at 09:13)</a>:</h4>
<p>Ahhh, yeah. That would be more than fine!</p>



<a name="207939784"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/146212-t-compiler/const-eval/topic/Do%20the%20const%20SIMD-shuffle%3F/near/207939784" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/146212-t-compiler/const-eval/topic/Do.20the.20const.20SIMD-shuffle.3F.html#207939784">(Aug 25 2020 at 09:14)</a>:</h4>
<p>can't tell if this is sarcasm <span aria-label="sweat smile" class="emoji emoji-1f605" role="img" title="sweat smile">:sweat_smile:</span></p>



<a name="207940001"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/146212-t-compiler/const-eval/topic/Do%20the%20const%20SIMD-shuffle%3F/near/207940001" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jubilee <a href="https://rust-lang.github.io/zulip_archive/stream/146212-t-compiler/const-eval/topic/Do.20the.20const.20SIMD-shuffle.3F.html#207940001">(Aug 25 2020 at 09:18)</a>:</h4>
<p>No, seriously! Either I'm completely missing something or basically there won't be any real problems~</p>



<hr><p>Last updated: Aug 07 2021 at 22:04 UTC</p>
</html>